-
Notifications
You must be signed in to change notification settings - Fork 168
fix(consume): fix consume_direct.sh
by quoting the testid passed to --filter
#1987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…_direct.sh would be invalid because the value after the --filter flag was not wrapped in parenthesis
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion on a change to the approach, thanks!
I have now figured out what we must change to also fix geth's evm command in the sh files. There actually are 2 issues with blockchain tests:
So e.g. currently in the .sh file you would see sth like:
when actually the command should be
|
Can be merged as is, I tested both |
Is making use of shlex a requirement to get this merged? The current solution works well and has been tested, I don't think this is a part of the codebase we will touch often |
I'd like to help you get this over the finishline @felix314159! I'm thinking something along these lines... def quote_arg(arg: str, shell: Shell | None = None) -> str:
shell = shell or _detect_default_shell()
if shell == "posix":
return shlex.quote(arg)
elif shell == "cmd":
# Use Windows C-runtime rules; safest is to let Python do it.
return subprocess.list2cmdline([arg])
else:
raise Exception(f"oops unsupported shell {shell}") I'd prefer to use standard libraries as Mario suggests, to avoid surprises with other special characters in the future. |
Let's not handle windows to keep things simple. I reworked the PR with shlex and it still works and i must admit it is easier to read now than before. Can be merged now |
consume_direct.sh
files contained invalid commands because value after --filter
flag was not enclosed in parenthesis (issue reported by flcl42)consume_direct.sh
by quoting the testid passed to --filter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @felix314159 - LGTM!
I tested geth quickly, but not Nethermind.
🗒️ Description
Title says it all, simple fix. Context: #1843 , more specifically this comment by flcl
What is fixed?
Before this PR, if you run sth like
uv run consume direct --bin=nethtest --input=stable@latest --traces --dump-dir=evm-tmp -n 8 -k push0
and then try to run a
consume_direct.sh
file like./evm-tmp/push0_contracts/tests-shanghai-eip3855_push0-test_push0.py::test_push0_contracts[fork_Shanghai-blockchain_test_from_state_test-gas_cost]/consume_direct.sh
you will see sth like:
This PR fixes this, after applying it the command works as expected (e.g.):
Both Nethtest and geth's evm were leading to faulty sh files and this PR fixes both.
🔗 Related Issues or PRs
N/A.
✅ Checklist
tox
checks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:uvx --with=tox-uv tox -e lint,typecheck,spellcheck,markdownlint
type(scope):
.mkdocs serve
locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.@ported_from
marker.